//
//  successView.m
//  CCSD
//
//  Created by LiBenCan on 17/10/30.
//  Copyright © 2017年 张露杰. All rights reserved.
//

#import "successView.h"
#import "BaseMBView.h"
@interface successView()
@end
@implementation successView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor whiteColor];
        [self.layer setCornerRadius:5*screenW_6];
        [self CreatUI:frame];
    }
    return self;
}
//创建View
-(void)CreatUI:(CGRect)frame
{
    if (!_successLab) {
        
        //成功Lab
        _successLab = [TomamaUI createLabel:CGRectMake(0, 40*screenW_6,frame.size.width,30*screenW_6) textAligment:1 font:[UIFont systemFontOfSize:17*screenW_6] textColor:mainColor text:@"添加成功"];
        [self addSubview:_successLab];
        
        //提示Lab
        _reminderLab = [TomamaUI createLabel:CGRectMake(0,CGRectGetMaxY(_successLab.frame),frame.size.width,40*screenW_6) textAligment:1 font:[UIFont systemFontOfSize:15*screenW_6] textColor:mainColor text:@"订单添加成功 可在订单详情中查看"];
        [self addSubview:_reminderLab];
        
        //成功图片
        _successImageV = [TomamaUI createImageView:CGRectMake(0, CGRectGetMaxY(_reminderLab.frame)+46*screenW_6, 186.5*screenW_6, 152*screenW_6) backGroundImageV:@"Order_success"];
        [self addSubview:_successImageV];
        _successImageV.center = CGPointMake(self.frame.size.width/2, _successImageV.center.y);
        
        UIButton *btn = [TomamaUI createButton:0 Frame:CGRectMake(self.frame.size.width - 42*screenW_6, 0, 42*screenW_6, 42*screenW_6) targ:self sel:@selector(cancleTap) titleColor:nil font:nil title:nil image:@"order_cancel" backGroundImage:nil];
        [self addSubview:btn];
    }
}

-(void)cancleTap//取消
{
    if (_cancleBlock) {
        self.cancleBlock();
    }
}

@end
